package com.example.mybatisplus01.pojo;


import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.example.mybatisplus01.enumation.SexEnum;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.Map;

@Data
@TableName(value = "user")
public class User {
    @TableId(value = "uid",type = IdType.AUTO)
    private Integer uid;
    @TableField(value = "username")
    private String username;
    private Integer age;
    //枚举类型
    private SexEnum sex;
    private String address;
    //类型转换。此处为map，数据库为varchar
    @TableField(typeHandler = FastjsonTypeHandler.class)
    private Map<String,Object> contact;
    @TableLogic
    private int is_delete;
    private Date default_time;

    @TableField(fill = FieldFill.INSERT)
    private Date createtime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updatetime;
}

//-----------------activeRecord
//实现持久层
//public interface UserMapper extends BaseMapper<User> {
//}
//@Data
//@TableName(value = "user")
//public class User extends Model<User> implements Serializable {
//    private static final long serialVersionUID = 6401942840459021558L;
////    @TableId(value = "uid",type = IdType.AUTO)
//    private Integer uid;
////    @TableField(value = "username")
//    private String username;
//    private Integer age;
//    private Integer sex;
//    private String address;
//
//}

